'''
Created on 2011-06-28

@author: Mikael
'''
from Model.GenericNode import GenericNode
from Model.Resource import Resource
from Model.Resource import ResourceType
from Model.EditorPath import EditorPath
from PyQt4 import QtGui


class NodeResource(GenericNode):
    
    def __init__(self, Resource):
        self.mResource = Resource
        super(NodeResource, self).__init__([Resource.mGUID, "Resource"])
        
        path = ""
        if Resource.mType == ResourceType.Effect:
            path = EditorPath.mIconFolderPath + EditorPath.mEffectIconFile
        elif Resource.mType == ResourceType.Material:
            path = EditorPath.mIconFolderPath + EditorPath.mMaterialIconFile
        elif Resource.mType == ResourceType.Texture:
            path = EditorPath.mIconFolderPath + EditorPath.mTextureIconFile
        elif Resource.mType == ResourceType.Scene:
            path = EditorPath.mIconFolderPath + EditorPath.mSceneIconFile
            
        if path != "":
            self.mIcon = QtGui.QIcon(path)
